<template>
  <app-remote-dlg
    v-bind="$props"
    :action="change">
  </app-remote-dlg>
</template>

<script>
  import { mixin } from '../../utils/widget/index'
  export default{
    name: 'AppWidget',
    componentName: 'AppWidget',
    props: ['result', 'options'],
    mixins: [mixin],
    methods: {
      filterData (options) { // 数据过滤
        return options
      },
      change () {
        this.action().then(data => {
          this.options.options = this.filterData(data)
        })
      },
      save (value) {
        this.result[this.options.key] = value
        // TODO 需要做方法格式的处理
      }
    },
    mounted () {
      console.log(this.result, this.options)
    }
  }
</script>
